package com.rc.evcharger.common.enums.yl;


/**
 * Create by Yang on 2021/10/14
 * <p>
 */
public enum YlStopReasonEnum {
    YlStopReason_0(0,"正常结束","BMS主动停机"),
    YlStopReason_1(1,"接收BMS的辨识报文超时时","充电机主动停止"),
    YlStopReason_2(2,"接收电池充电参数报文超时","充电机主动停止"),
    YlStopReason_3(3,"接收BMS完成充电准备报文超时","充电机主动停止"),
    YlStopReason_4(4,"接收电池充总状态报文超时","充电机主动停止"),
    YlStopReason_5(5,"接收电池充电需求报文超时","充电机主动停止"),
    YlStopReason_6(6,"接收BMS中止充电报文超时","充电机主动停止"),
    YlStopReason_7(7,"接收BMS充电统计报文超时","充电机主动停止"),
    YlStopReason_20(20,"收到bst报文停止","BMS报文错误，充电机主动停止"),
    YlStopReason_21(21,"收到BSM报文错误停止","BMS主动停止BMS发送BSM状态有误，充"),
    YlStopReason_22(22,"bms电池达到设定温度","电机主动停止"),
    YlStopReason_23(23,"单体电压过高异常","BMS报文的当前温度比BMS发送的最高允许温度高或超过人工设定值（目前默认是100度），充电机主动停止"),
    YlStopReason_24(24,"需求电流异常","BMS报文的当前温度比BMS发送的最高允许单体电压高或超过人工设定值（目前默认是6V),充电机主动停止"),
    YlStopReason_25(25,"BST的SOC目标值","需求电流是负数，充电机主动停止"),
    YlStopReason_30(30,"BST的电压设定值","BMS发出BST报文,BMS主动停止"),
    YlStopReason_31(31,"BST单体电压满","BMS发出BST报"),
    YlStopReason_32(32,"BST_00_6","BMS发出BST报"),
    YlStopReason_33(33,"BST绝缘故障","BMS主动停止"),
    YlStopReason_34(34,"BST连接器过温","BMS发出BST报文，BMS主动停止"),
    YlStopReason_35(35,"BST元件过温","BMS发出BST报文，BMS主动停止"),
    YlStopReason_36(36,"BST连接器故障","BMS发出BST报文，BMS主动停止"),
    YlStopReason_37(37,"BST电池组过温","BMS发出ST报文,BMS主动停止"),
    YlStopReason_38(38,"BST其他故障","BMS发出BST报文，BMS主动停止"),
    YlStopReason_39(39,"BST_02_4","BMS发出BST报文，BMS主动停止"),
    YlStopReason_40(40,"BST电压异常","BMS发出BST报文，BMS主动停止"),
    YlStopReason_43(43,"","BMS发出BST报文，BMS主动停止"),
    YlStopReason_200(200,"用户中止","用户操作停止，充电机主动停止"),
    YlStopReason_201(201,"系统告警1","控制板上报告警，充电机主动停止"),
    YlStopReason_202(202,"系统告警2","控制板上报告警，充电机主动停止"),
    YlStopReason_300(300,"CC1连接断开","CC1断开，充电机主动停止"),
    YlStopReason_301(301,"用户刷卡停止","用户刷卡停止，充电机主动停止"),
    YlStopReason_302(302,"紧急停机","用户操作紧急按钮，充电机主动停止"),
    YlStopReason_303(303,"预处理加电失败","充电卡锁定失败，充电机主动停止"),
    YlStopReason_304(304,"绝缘检测异常","充电机主动停止"),
    YlStopReason_305(305,"控制板通讯异常","充电机主动停止"),
    YlStopReason_306(306,"充电电量达到设定值","充电机主动停止"),
    YlStopReason_307(307,"充电时间达到设定值","充电机主动停止"),
    YlStopReason_308(308,"充电金额达到设定值","充电机主动停止"),
    YlStopReason_309(309,"电表通讯异常","充电机主动停止"),
    YlStopReason_310(310,"充电金额超过用户卡余额","充电机主动停止"),
    YlStopReason_311(311,"后台终止","收到后台关机指令，充电机主动停止控制板上报系统故"),
    YlStopReason_312(312,"系统告警中止","控制板上报系统故障，充电机主动停止"),
    YlStopReason_313(313,"后台通讯中止","集中器通讯断开，充电机主动停止"),
    YlStopReason_314(314,"充电电压异常中止","控制板上传充电电压比需求电压大，充电机主动停止"),
    YlStopReason_315(315,"充电电流异常中止","控制板上传充电电流比需求电流大，充电机主动停止"),
    YlStopReason_316(316,"BMS的SOC满中止","系统SOC达到设定值（默认100%)，充电机主动停止"),
    YlStopReason_317(317,"电表电量异常增大中止","电表电量突然持续异常跳变到较大的值，监控板和控制板都要判断"),
    YlStopReason_318(318,"电表电量异常变小中止","电表电量突然持续异常跳变到较小的值，监控板和控制板都要判断"),
    YlStopReason_319(319,"VIN码不匹配","车辆VIN码与设定的不匹配"),
    YlStopReason_401(401,"管理员界面中止",""),
    YlStopReason_402(402,"软件升级","系统软件进行升级，中止充电"),
    YlStopReason_403(403,"充电启动超时","启动充电时间60秒内没进入充电阶段"),
    YlStopReason_404(404,"BMS单体动力蓄电池电压异常",""),
    YlStopReason_405(405,"BMS整车动力蓄电池荷电状态","系统突然断电，充电机主动停止"),
    YlStopReason_406(406,"BMS动力蓄电池充电过电流",""),
    YlStopReason_407(407,"BMS动力蓄电池温度过高",""),
    YlStopReason_408(408,"BMS动力蓄电池绝缘状态",""),
    YlStopReason_409(409,"BMS蓄电池组输出连接器状态",""),
    YlStopReason_410(410,"充电电压超过BMS最大允许值",""),
    YlStopReason_411(411,"BMS其他位状态异常",""),
    YlStopReason_412(412,"BCS上传电压异常",""),
    YlStopReason_2000(2000,"系统其他故障",""),
    YlStopReason_2001(2001,"紧急停机故障",""),
    YlStopReason_2002(2002,"绝缘故障",""),
    YlStopReason_2003(2003,"直流过压",""),
    YlStopReason_2004(2004,"直流欠压",""),
    YlStopReason_2005(2005,"软启失败",""),
    YlStopReason_2006(2006,"输出反接故障",""),
    YlStopReason_2007(2007,"接触器异常",""),
    YlStopReason_2008(2008,"模块故障",""),
    YlStopReason_2009(2009,"电网电压高",""),
    YlStopReason_2010(2010,"电网电压低",""),
    YlStopReason_2011(2011,"电网频率高",""),
    YlStopReason_2012(2012,"电网频率低",""),
    YlStopReason_2013(2013,"模块通信异常",""),
    YlStopReason_2014(2014,"模块类型不一致",""),
    YlStopReason_2015(2015,"系统辅源掉电",""),
    YlStopReason_2016(2016,"直流输出断路",""),
    YlStopReason_2017(2017,"进风口过温保护",""),
    YlStopReason_2018(2018,"进风口低温保护",""),
    YlStopReason_2019(2019,"出风口过温保护",""),
    YlStopReason_2020(2020,"群充模块过温",""),
    YlStopReason_2021(2021,"防雷故障",""),
    YlStopReason_2022(2022,"交流接触器异常",""),
    YlStopReason_100001(100001,"100000以上故障为迪文通信告警",""),
    YlStopReason_100002(100002,"读卡器通信告警",""),
    YlStopReason_100003(100003,"防雷器故障",""),
    YlStopReason_100004(100004,"主开关及熔断器故障",""),
    YlStopReason_100005(100005,"紧急停机故障",""),
    YlStopReason_100032(100032,"电表1通信异常",""),
    YlStopReason_100033(100033,"电表2通信异常",""),
    YlStopReason_101000(101000,"断开连接",""),
    YlStopReason_101001(101001,"未准备就绪",""),
    YlStopReason_101002(101002,"充电过压",""),
    YlStopReason_101003(101003,"充电过流",""),
    YlStopReason_101004(101004,"充电欠压",""),
    YlStopReason_101005(101005,"用户刷卡停止充电",""),
    YlStopReason_101006(101006,"后台停止",""),
    YlStopReason_101007(101007,"充电时间达到设定值","充电机主动停止"),
    YlStopReason_101008(101008,"充电金额达到设定值","充电机主动停止"),
    YlStopReason_101009(101009,"充电电量达到设定值","充电机主动停止"),
    YlStopReason_101010(101010,"应用软件升级停止",""),
    YlStopReason_101011(101011,"系统掉电停止",""),
    YlStopReason_101012(101012,"未知原因",""),
    YlStopReason_101013(101013,"用户界面中止",""),
    YlStopReason_101014(101014,"金额不足",""),
    YlStopReason_101015(101015,"电池充满",""),
    YlStopReason_101016(101016,"达到用户设定充电条件停止",""),
    ;


    private Integer code;

    private String msg;

    private String detail;

    YlStopReasonEnum(Integer code, String msg, String detail) {
        this.code = code;
        this.msg = msg;
        this.detail = detail;
    }

    /**
     * 解析code
     *
     * @param code
     * @return
     */
    public static String getStopReasonMsg(int code) {
//        Integer intCode = Integer.parseInt(code, 16);
        Class<YlStopReasonEnum> ylStopReasonEnumClass = YlStopReasonEnum.class;
        for (YlStopReasonEnum enumConstant : ylStopReasonEnumClass.getEnumConstants()) {
            if (enumConstant.getCode() == code) {
                return enumConstant.getMsg();
            }
        }
        return "未知故障码code:" + code;
    }

    public Integer getCode() {
        return code;
    }

    YlStopReasonEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public void setCode(Integer code) {
        this.code = code;
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public static void main(String[] args) {
//        String stopReasonMsg = YlStopReasonEnum.getStopReasonMsg("3EA");
//        System.out.println(stopReasonMsg);
    }

}
